<?xml version='1.0' encoding='UTF-8' ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:t="http://myfaces.apache.org/tomahawk">
    <head>

    </head>
    <body>
        <ui:composition template="/MenuTemplate_wave.xhtml">
            <ui:define name="content_nav">
                #{msg.content_nav_costmanage}
            </ui:define>
            <ui:define name="content">
                <h:form id="iptPayForm">
                    <h:panelGrid  styleClass="body_content_box" columns="1">
                        <h:messages globalOnly="true" infoClass="info"  errorClass="alert" fatalClass="colorOrange" />
                        <h:panelGrid styleClass="search_border" columns="1" cellpadding="0" cellspacing="0">
                            <h:panelGrid styleClass="search_title" columns="1" cellpadding="0"
                                         cellspacing="2">
                                <h:outputLabel value="#{msg.content_title_invoice_detail}"  style="vertical-align: middle"/>
                            </h:panelGrid>
                            <h:panelGrid styleClass="panelGrid_bottom_line" style="width: 100%" cellpadding="0" border="0" cellspacing="0">
                                <h:panelGrid columns="3" cellspacing="6" style="width: 95%">
                                    <h:panelGrid columnClasses="com_width_75,com_width_150" columns="2" cellpadding="0" border="0" cellspacing="0">
                                        <h:outputLabel value="#{msg.label_order_pro}" styleClass="com_label_blue"></h:outputLabel>
                                        <h:selectOneMenu value="#{paymentBean.paymentInfo.payPro}" rendered="#{paymentBean.currentOperation == 2}">
                                            <f:selectItems value="#{paymentBean.payProList}"/>
                                        </h:selectOneMenu>
                                        <h:outputText value="#{paymentBean.paymentInfo.displayPayPro}" rendered="#{paymentBean.currentOperation == 1}"/>
                                    </h:panelGrid>
                                    <h:panelGrid columnClasses="com_width_75,com_width_150" columns="2" cellpadding="0" border="0" cellspacing="0">
                                        <h:outputLabel value="#{msg.label_payment_invest}" styleClass="com_label_blue"></h:outputLabel>
                                        <h:selectOneMenu value="#{paymentBean.paymentInfo.investInterface}" rendered="#{paymentBean.currentOperation == 2}">
                                            <f:selectItems value="#{paymentBean.investIntList}"/>
                                        </h:selectOneMenu>
                                        <h:outputText value="#{paymentBean.paymentInfo.displayInvestInt}" rendered="#{paymentBean.currentOperation == 1}"/>
                                    </h:panelGrid>
                                    <h:panelGrid columnClasses="com_width_75,com_width_200" columns="2" cellpadding="0" border="0" cellspacing="0">
                                        <h:outputLabel value="#{msg.label_enterprise_name}" styleClass="com_label_blue"></h:outputLabel>
                                        <h:selectOneMenu value="#{paymentBean.paymentInfo.enterpriseInfo.enterpriseId}" rendered="#{paymentBean.currentOperation == 2}">
                                            <f:selectItems value="#{paymentBean.enterpriseList}"/>
                                        </h:selectOneMenu>
                                        <h:outputText value="#{paymentBean.paymentInfo.enterpriseInfo.enterpriseName}" rendered="#{paymentBean.currentOperation == 1}"></h:outputText>
                                    </h:panelGrid>
                                    <h:panelGrid columnClasses="com_width_75,com_width_150" columns="2" cellpadding="0" border="0" cellspacing="0">
                                        <h:outputLabel value="#{msg.label_invoice_code}" styleClass="com_label_blue"></h:outputLabel>
                                        <h:inputText value="#{paymentBean.paymentInfo.invoiceNo}" rendered="#{paymentBean.currentOperation == 2}"></h:inputText>
                                        <h:outputText value="#{paymentBean.paymentInfo.invoiceNo}" rendered="#{paymentBean.currentOperation == 1}" />
                                    </h:panelGrid>
                                    <h:panelGrid columnClasses="com_width_75,com_width_150" columns="2" cellpadding="0" border="0" cellspacing="0">
                                        <h:outputLabel value="#{msg.label_invoice_value}" styleClass="com_label_blue">
                                        </h:outputLabel>
                                        <h:inputText value="#{paymentBean.paymentInfo.invoiceValue}" rendered="#{paymentBean.currentOperation == 2}">
                                        </h:inputText>
                                        <h:outputText value="#{paymentBean.paymentInfo.invoiceValue}" rendered="#{paymentBean.currentOperation == 1}"></h:outputText>
                                    </h:panelGrid>                          
                                    <h:panelGrid columnClasses="com_width_75,com_width_200" columns="2" cellpadding="0" border="0" cellspacing="0">
                                        <h:outputLabel value="#{msg.label_invoice_sumit_date}" styleClass="com_label_blue"></h:outputLabel>
                                        <t:inputCalendar value="#{paymentBean.paymentInfo.invSubdate}"  rendered="#{paymentBean.currentOperation == 2}"
                                                         renderAsPopup="true" popupDateFormat="yyyy-MM-dd" helpText="YYYY-MM-DD"
                                                         popupButtonString="..." popupTheme="WH" />
                                        <h:outputText value="#{paymentBean.paymentInfo.invSubdate}"  rendered="#{paymentBean.currentOperation == 1}">
                                            <f:convertDateTime pattern="yyyy-MM-dd"  timeZone="GMT+8" />
                                        </h:outputText>
                                    </h:panelGrid>
                                    <h:panelGrid columnClasses="com_width_75,com_width_150" columns="2" cellpadding="0" border="0" cellspacing="0">
                                        <h:outputLabel value="#{msg.label_payment_type}" styleClass="com_label_blue"></h:outputLabel>
                                        <h:selectOneMenu value="#{paymentBean.paymentInfo.payType}" rendered="#{paymentBean.currentOperation == 2}">
                                            <f:selectItems value="#{paymentBean.payTypeList}"/>
                                        </h:selectOneMenu>
                                        <h:outputText value="#{paymentBean.paymentInfo.displayPayType}" rendered="#{paymentBean.currentOperation == 1}"/>
                                    </h:panelGrid>
                                    <h:panelGrid columnClasses="com_width_75,com_width_150" columns="2" cellpadding="0" border="0" cellspacing="0">
                                        <h:outputLabel value="#{msg.label_invoice_remark}" styleClass="com_label_blue"></h:outputLabel>
                                        <h:inputText value="#{paymentBean.paymentInfo.payRemarks}" rendered="#{paymentBean.currentOperation == 2}"/>
                                        <h:outputText value="#{paymentBean.paymentInfo.payRemarks}" rendered="#{paymentBean.currentOperation == 1}"/>
                                    </h:panelGrid>
                                    <h:panelGrid columnClasses="com_width_75,com_width_200" columns="2" cellpadding="0" border="0" cellspacing="0">
                                        <h:outputLabel value="#{msg.label_payment_payed}" styleClass="com_label_blue"></h:outputLabel>
                                        <h:selectBooleanCheckbox value="#{paymentBean.paymentInfo.payed}" disabled="#{paymentBean.currentOperation == 1}" >
                                        </h:selectBooleanCheckbox>
                                    </h:panelGrid>
                                    <h:panelGrid cellspacing="0" cellpadding="0" columns="1">
                                        <h:commandButton value="#{msg.bt_saveinvoice_only}" action="#{paymentBean.saveInvoiceOnly}"  rendered="#{paymentBean.currentOperation == 2}"/>
                                    </h:panelGrid>
                                </h:panelGrid>
                            </h:panelGrid>
                        </h:panelGrid>
                    </h:panelGrid>
                   
                    <h:panelGrid  styleClass="body_content_box" columns="1">
                        <h:panelGrid styleClass="panelGrid_bottom_line" style="width: 100%" cellpadding="0" border="0" cellspacing="0">
                            <h:panelGrid styleClass="table_border" columns="1" cellpadding="0" cellspacing="0">
                                <h:panelGrid columns="2" styleClass="table_title"  cellpadding="0"
                                             cellspacing="2">
                                    <h:panelGrid columnClasses="com_width_75, com_width_75, com_width_75" columns="3" cellpadding="0" cellspacing="0">
                                        <h:outputLabel value="#{paymentBean.tableTitle}"  style="vertical-align: middle"/>
                                        <h:commandLink id="popupCmdLnk" onclick="doPopup(this); return false;" target="popup"
                                                       value="#{msg.bt_order_select}" />
                                        <h:commandLink value="#{msg.bt_generate_adjust_table}" action="#{paymentBean.genAdjustTable}" />
                                    </h:panelGrid>
                                    <h:outputLabel />
                                </h:panelGrid>
                                <t:dataTable id="dataTable" value="#{paymentBean.data}"
                                             var="row"
                                             headerClass="table_header"
                                             styleClass="mxl"
                                             rowClasses="list-row1-background,list-row2-background"
                                             >
                                    <t:column width="8%">
                                        <f:facet name="header">
                                            <h:outputLabel value="#{msg.label_project_code}"></h:outputLabel>
                                        </f:facet>
                                        <h:outputText value="#{row.orderInfo.projectCode}"/>
                                    </t:column>
                                    <t:column width="12%">
                                        <f:facet name="header">
                                            <h:outputLabel value="#{msg.label_order_code}"></h:outputLabel>
                                        </f:facet>
                                        <h:outputText value="#{row.orderInfo.orderCode}"/>
                                    </t:column>
                                    <t:column width="20%">
                                        <f:facet name="header">
                                            <h:outputLabel value="#{msg.label_contact_code}"></h:outputLabel>
                                        </f:facet>
                                        <h:outputText value="#{row.orderInfo.contactCode}"/>
                                    </t:column>
                                    <t:column width="18%">
                                        <f:facet name="header">
                                            <h:outputLabel value="#{msg.label_task_name}"></h:outputLabel>
                                        </f:facet>
                                        <h:outputText value="#{row.orderInfo.taskName}"/>
                                    </t:column>
                                    <t:column width="8%">
                                        <f:facet name="header">
                                            <h:outputLabel value="#{msg.label_order_value}"></h:outputLabel>
                                        </f:facet>
                                        <h:outputText value="#{row.orderInfo.orderValue}"/>
                                    </t:column>
                                    <t:column width="8%">
                                        <f:facet name="header">
                                            <h:outputLabel value="#{msg.label_audited_value}"></h:outputLabel>
                                        </f:facet>
                                        <h:inputText value="#{row.orderInfo.auditedValue}" styleClass="com_width_75" rendered="#{paymentBean.currentOperation == 2}" />
                                        <h:outputText value="#{row.orderInfo.auditedValue}" styleClass="com_width_75" rendered="#{paymentBean.currentOperation == 1}"/>
                                    </t:column>
                                    <t:column width="8%">
                                        <f:facet name="header">
                                            <h:outputLabel value="#{msg.label_pay_value}"></h:outputLabel>
                                        </f:facet>
                                        <h:inputText value="#{row.payValue}" styleClass="com_width_75" onchange="submit();" rendered="#{paymentBean.currentOperation == 2}" />
                                        <h:outputText value="#{row.payValue}" styleClass="com_width_75" rendered="#{paymentBean.currentOperation == 1}"  />
                                    </t:column>
                                    <t:column width="5%" rendered="#{paymentBean.currentOperation == 2}">
                                        <f:facet name="header">
                                            <h:outputLabel />
                                        </f:facet>
                                        <h:commandLink value="#{msg.lnk_remove}" action="#{paymentBean.deleteData}" />
                                    </t:column>
                                </t:dataTable>
                            </h:panelGrid>
                            <h:panelGrid columns="3" cellspacing="2" style="width: 90%">
                                <h:panelGrid columns="2">
                                    <h:outputLabel value="#{msg.label_pay_serial_no}" styleClass="com_label_blue"/>
                                    <h:inputText value="#{paymentBean.paymentInfo.serialNo}" rendered="#{paymentBean.currentOperation == 2}"/>
                                    <h:outputText value="#{paymentBean.paymentInfo.serialNo}" rendered="#{paymentBean.currentOperation == 1}"/>
                                </h:panelGrid>
                                <h:panelGrid columns="2">
                                    <h:outputLabel value="#{msg.label_total_pay_value}" styleClass="com_label_blue"/>
                                    <h:inputText value="#{paymentBean.totalPayValue}" disabled="true" rendered="#{paymentBean.currentOperation == 2}"/>
                                    <h:outputText value="#{paymentBean.totalPayValue}" rendered="#{paymentBean.currentOperation == 1}"/>
                                </h:panelGrid>
                                <h:panelGrid columnClasses="com_width_75,com_width_200" columns="2" cellpadding="0" border="0" cellspacing="0">
                                    <h:outputLabel value="#{msg.label_payment_sumit_date}" styleClass="com_label_blue"></h:outputLabel>
                                    <t:inputCalendar value="#{paymentBean.paymentInfo.payDate}"  rendered="#{paymentBean.currentOperation == 2}"
                                                     renderAsPopup="true" popupDateFormat="yyyy-MM-dd" helpText="YYYY-MM-DD"
                                                     popupButtonString="..." popupTheme="WH" />
                                    <h:outputText value="#{paymentBean.paymentInfo.payDate}" rendered="#{paymentBean.currentOperation == 1}">
                                        <f:convertDateTime pattern="yyyy-MM-dd"  timeZone="GMT+8"/>
                                    </h:outputText>
                                </h:panelGrid>
                            </h:panelGrid>
                        </h:panelGrid>
                    </h:panelGrid>
                    <h:panelGrid  styleClass="body_content_box" columns="1" >
                        <h:panelGrid columns="2" >
                        <h:commandButton value="#{msg.bt_return}" action="#{paymentBean.toLastPage}"/>
                        <h:commandButton value="#{msg.bt_save_payment}" action="#{paymentBean.savePayment}" rendered="#{paymentBean.currentOperation == 2}" />
                        </h:panelGrid>
                    </h:panelGrid>
                </h:form>
            </ui:define>
        </ui:composition>
    </body>
</html>